//
// Created by yunnan xu on 2020/12/8.
//

#ifndef ANDROIDGRAPHICSDEMOS_CONVEX_H
#define ANDROIDGRAPHICSDEMOS_CONVEX_H

#include <vector>
#include "ext.hpp"
#include "glm.hpp"
#include "Basic.h"

namespace Phy {

    class Convex
    {
    public:

        Convex() = default;
        virtual ~Convex() = default;
        virtual void UpdateWithModelMatrix(glm::mat4 model_mat) = 0;
        virtual Point GetSupport(glm::vec3 dir) = 0;

    private:

    };

    class PolyConvex : public Convex
    {

    public:

        PolyConvex() = default;
        PolyConvex(std::vector<glm::vec3> & origin_convex_points);
        virtual ~PolyConvex() = default;

        const std::vector<Point> & GetPoints();
        virtual void UpdateWithModelMatrix(glm::mat4 model_mat);
        virtual Point GetSupport(glm::vec3 dir);

    private:
        int convex_points_number;
        std::vector<Point> convex_points;
        std::vector<glm::vec4> origin_points;
    };
}


#endif //ANDROIDGRAPHICSDEMOS_CONVEX_H
